<script>
	import {
		mapMutations
	} from 'vuex'
	export default {
		onLaunch: function() {
			// #ifdef MP-WEIXIN
			let _self = this;
			uni.login({
				provider: 'weixin',
				success: function(loginRes) {
					uni.getUserInfo({
						provider: 'weixin',
						success: function(infoRes) {
							let userInfo = infoRes.userInfo;
							userInfo.code = loginRes.code;
							_self.$post(_self.$api.login, userInfo).then(res => {
								if (res.code == 0) {
									_self.login(res.loginInfo);
								} else {
									uni.showModal({
										title: '操作提示',
										content: res.msg,
										showCancel: false
									})
								}
							});
						}
					});
				}
			});
			// #endif
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			...mapMutations(['login']),
		}
	}
</script>

<style>
	/*每个页面公共css */
	@import './common/uni.css';
	@import "assets/css/weui.css";
	@import "assets/css/weuix.css";
	@import "assets/css/school.css";
	@import "assets/fonts/iconfont.css";


	.page {
		margin-bottom: 96rpx;
	}

	/* @import url("/static/style/weui.wxss");
	
	page{
	    background-color: #EDEDED;
	    font-size: 16px;
	    font-family: -apple-system-font,Helvetica Neue,Helvetica,sans-serif;
	}
	.page__hd {
	    padding: 40px;
	}
	.page__bd {
	    padding-bottom: 40px;
	}
	.page__bd_spacing {
	    padding-left: 15px;
	    padding-right: 15px;
	}
	
	.page__ft{
	    text-align: center;
	    padding:0 0 10px;
	    padding:0 0 calc(10px + constant(safe-area-inset-bottom));
	    padding:0 0 calc(10px + env(safe-area-inset-bottom));
	}
	
	
	.page__title {
	    text-align: left;
	    font-size: 20px;
	    font-weight: 400;
	}
	
	.page__desc {
	    margin-top: 5px;
	    color: #888888;
	    text-align: left;
	    font-size: 14px;
	}
	.weui-cell_example:before{
	    left:52px;
	} */
</style>
